﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NaiveBayesClassifier
{
    public class CAttributeValue
    {
        private object value;
        private int count;

        #region Getter and Setter
        public object GetValue()
        {
            return value;
        }

        public int GetCount()
        {
            return count;
        }
        #endregion

        public CAttributeValue(object value)
        {
            this.value = value;
            this.count = 1;
        }

        public void IncreaseCount()
        {
            ++count;
        }

        public override bool Equals(object obj)
        {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (this.GetType() != obj.GetType())
                return false;
            CAttributeValue other = (CAttributeValue) obj;
            if (value == null)
            {
                if (other.value != null)
                    return false;
            }
            else if (!value.Equals(other.value))
                return false;
            return true;
        }

        public override int GetHashCode()
        {
            return value.GetHashCode();
        }

        public override string ToString()
        {
            return value.ToString();
        }
    }
}
